package com.jiangxjsy.admin.service.impl;

import com.jiangxjsy.admin.mapper.AdminUserConfigMapper;
import com.jiangxjsy.admin.service.AdminUserConfigService;
import com.jiangxjsy.model.admin.entity.AdminUserConfig;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * wukong-crm-master
 * 蒋胜宇
 * 2025/6/6 19:29
 */

@Service
public class AdminUserConfigServiceImpl implements AdminUserConfigService {
    @Resource
    private AdminUserConfigMapper adminUserConfigMapper;

    /**
     * 根据用户id和名称查询用户配置
     *
     * @param userId 用户id
     * @param name 配置名称
     * @return 用户配置
     */
    @Override
    public AdminUserConfig queryUserConfigByUserIdAndName(Long userId, String name) {
        return adminUserConfigMapper.selectByUserIdAndName(userId, name);
    }

    /**
     * 初始化用户配置
     *
     * @param userId 用户id
     */
    @Override
    public void initUserConfig(Long userId) {
        List<AdminUserConfig> adminUserConfigList = new ArrayList<>();
        adminUserConfigList.add(new AdminUserConfig(null, userId, 1L, "ActivityPhrase", "电话无人接听", "跟进记录常用语"));
        adminUserConfigList.add(new AdminUserConfig(null, userId, 1L, "ActivityPhrase", "客户无意向", "跟进记录常用语"));
        adminUserConfigList.add(new AdminUserConfig(null, userId, 1L, "ActivityPhrase", "客户意向度适中，后续继续跟进", "跟进记录常用语"));
        adminUserConfigList.add(new AdminUserConfig(null, userId, 1L, "ActivityPhrase", "客户意向度较强，成交几率较大", "跟进记录常用语"));
        Integer ignore = adminUserConfigMapper.insertAdminUserConfigBatch(adminUserConfigList);
    }
}
